<%-- 
    Document   : selecionarCliente
    Created on : Apr 22, 2008, 6:26:12 PM
    Author     : Tom Hayden
--%>

<%@page contentType="text/html" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<h1><fmt:message key="selecionarcliente.title"/></h1>
<form name="selecionarClienteForm" action="selecionarCliente.do" method="post">
    <div style="width: 450px; margin: 2em 0 2em 0;">
        <input type="hidden" name="method" value="consultar" />
        Nome<br>
        <input type="text" name="description" value="${description}" size="40" />
        <input type="submit" value="<fmt:message key="global.label.botaopesquisar"/>" />
        <input type="button" value="<fmt:message key="global.label.botaovoltar"/>" onclick="goURL('${previousAction}');" />
    </div>
    
    <c:if test="${not empty clientes}">
        <div style="margin: 2em 0 1em 0;">
            <input type="button" value="<fmt:message key="global.label.botaoselecionar"/>" onclick="callAction('selecionarCliente', 'selecionar', 'selecionarClienteForm');"/>
        </div>
        <table class="grid">
            <tr>
                <th>&nbsp;</th>
                <th>Nome</th>
                <th>Sexo</th>
                <th>CPF</th>
            </tr>
            <c:forEach var="cliente" items="${clientes}" varStatus="idx">
                <tr>
                    <td><input type="radio" class="element" name="id" value="${cliente.id}" <c:if test="${idx.index == 0}">checked</c:if> /></td>
                    <td>${cliente.description}</td>
                    <td>${cliente.sexo.description}</td>
                    <td>${cliente.CPF}</td>
                </tr>
            </c:forEach>
        </table>
    </c:if>
</form>